Skip to main content

Backup/Restore with MySQL database in Windows

Introduction

  • This document contains steps to perform backup and restore operations of aiv Database with MySQL database in Windows platform. There are 2 ways we can perform this,
  1. Using command prompt

  2. Workbench application

1. Using Command prompt

Backup

List of commands used to perform backup and restore operation are marked below,

1.1 Open file explorer and navigate where your MySQL is installed. By default, this would be in program files or program files (x86). OR Open command prompt and change directory to bin folder of MySQL and skip next step [1.2]

1.2 Go to bin folder and open command prompt from bin folder.

1.3 write below command in command prompt to take backup of required database and store it at required location in your machine.

mysqldump -u root -p aiv > (your_directory)/Documents/dumps/Dump25112021.sql

Docusaurus Slash Introduction

The parameters of the said command as follows:

username: A valid MySQL username.

p: stands for password, keep it blank as of now. [when you hit enter it will ask for password then you have entered it]

aiv : A valid Database name you want to take backup.

(your_directory)/Documents/dumps/ : It’s a path where you need to store file.

Dump25112021.sql : The name of backup dump file you want to generate.

1.4 Hit enter and you will be prompted for password, provide password and hit enter.

password - A valid MySQL password for the user.

Docusaurus Slash Introduction

1.5 After backup completes, you can find dump file with the name given in command at location specified. You will see command like below screen after backup completes,

Restore

Follow below steps to restore database dump file [.sql] file in MySQL database using command prompt.

Docusaurus Slash Introduction

1.6 open command prompt and change directory inside bin folder of MySQL.

1.7 write below command to restore dump file,

mysql -u root -p backupaiv < (your_directory)/Documents/dumps/Dump25112021.sql

The parameters of the said command as follows:

Backupaiv : name of database where we want to restore dump file.

(your_directory)/Documents/dumps/Dump25112021.sql : path where dump file is located

1.8 hit enter and you will be prompted for password. Enter password and hit enter.

Docusaurus Slash Introduction

1.9 Wait for some time, wait till CMD is pointing again at current directory and ready to accept new command.

1.10 And it is done. Your dump file is restored successfully.

2. Using Workbench UI

For Backup and restore database using self-contained file [.sql] please follow steps provided in below link,

Click Here..